package database

import "time"

type Account string
type Tx struct {
	From      Account `bson:"from"`
	To        Account `bson:"to"`
	Value     uint    `bson:"value"`
	Data      string  `bson:"data"`
	Timestamp int64   `bson:"time"`
}

func NewTx(from Account, to Account, value uint, data string) *Tx {
	return &Tx{From: from, To: to, Value: value, Data: data, Timestamp: time.Now().Unix()}
}

func (t *Tx) IsReward() bool {
	return t.Data == "reward"
}
